package com.flower8.service.impl;

import com.flower8.dao.GuideDao;
import com.flower8.model.Banner;
import com.flower8.model.Guide;
import com.flower8.service.GuideService;
import com.flower8.utils.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description:
 * @Author: tanglin
 * @Date: 2019/10/23 13:56
 * @Version: 1.0
 */
@Service
public class GuideServiceImpl implements GuideService {

    @Autowired
    private GuideDao guideDao;

    /**
     * 查询引导页列表
     * @param pd
     * @return
     * @throws Exception
     */
    @Override
    public List<Guide> getGuideList(PageData pd) throws Exception {
        return guideDao.getGuideList(pd);
    }

    /**
     * 查询引导页列表数量
     * @param pd
     * @return
     * @throws Exception
     */
    @Override
    public int getGuideListCount(PageData pd) throws Exception {
        return guideDao.getGuideListCount(pd);
    }

    /**
     * 根据引导页卡id查询
     * @param pd
     * @return
     */
    @Override
    public Guide getGuideById(PageData pd) throws Exception {
        return guideDao.getGuideById(pd);
    }

    /**
     * 更新引导页
     * @param guide
     * @throws Exception
     */
    @Override
    @Transactional
    public void updateGuide(Guide guide) throws Exception {
        guideDao.updateGuide(guide);
    }

    /**
     * 删除引导页
     * @param id
     * @throws Exception
     */
    @Override
    @Transactional
    public void deleteGuide(long id) throws Exception {
        guideDao.deleteGuide(id);
    }

    /**
     * 新增引导页
     * @param guide
     * @throws Exception
     */
    @Override
    @Transactional
    public void addGuide(Guide guide) throws Exception {
        guideDao.addGuide(guide);
    }
}
